﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Linq.Expressions;
using System.ServiceModel;

namespace $rootnamespace$.DataAccess.Interface
{
    /// <summary>
    /// Core Data Access methods/properties
    /// </summary>
    /// <typeparam name="T"></typeparam>
    [ServiceContract]
    public interface IBaseDA<T>
    {
        IDataAccessAccessPoint DataAccess { get; set; }
        object DatabaseContext { get; set; }

        [OperationContract]
        bool Insert(T t);

        [OperationContract]
        int InsertReturnId(T t);

        [OperationContract]
        long InsertReturnLongId(T t);

        [OperationContract]
        bool Update(T t);

        [OperationContract]
        bool Delete(T t);

        [OperationContract]
        bool DeleteAll();

        [OperationContract]
        T GetById(object id);

        [OperationContract]
        IEnumerable<T> GetAll();

        [OperationContract]
        IList<T> GetAllAsList();

        [OperationContract]
        HashSet<T> GetAllAsHashSet();

        IEnumerable<T> Where(Expression<Func<T, bool>> expression);

        IList<T> WhereAsList(Expression<Func<T, bool>> expression);

        HashSet<T> WhereAsHashSet(Expression<Func<T, bool>> expression);

        [OperationContract]
        int Count();
        int Count(Expression<Func<T, bool>> expression);

        [OperationContract]
        bool IsEmpty();
        bool IsEmpty(Expression<Func<T, bool>> expression);
    }}
